<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>模态框的最大化 - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.min.css">
<style>
.modal-fullscreen-btn {
    border: none;
    background-color: transparent;
    color: #000;
    opacity: 0.6;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    margin: -0.5rem -0.5rem -0.5rem auto;
}
.modal-fullscreen-btn .mdi:before {
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: middle;
    content: "\f0293";
    line-height: 1;
}
.modal-fullscreen-btn:hover {
    opacity: .8;
}
.modal-fullscreen {
    padding-left: 0px!important;
}
.modal-fullscreen .modal-fullscreen-btn {
    opacity: .95;
}
.modal-fullscreen .modal-fullscreen-btn .mdi:before {
    content: "\f0294";
}
.modal-fullscreen .modal-dialog {
    width: -webkit-calc(100% - 20px);
	width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    margin: 8px auto;
}
.modal-fullscreen .modal-dialog .modal-body {
    height: -webkit-calc(100vh - 56px - 69px - 20px);
    height: calc(100vh - 56px - 69px - 20px);
    overflow-y: auto;
}
</style>
</head>
  
<body>
<div class="container-fluid">

  <div class="row">

  	<div class="col-lg-12">
  	  <div class="card">
  	    <header class="card-header">
  	      <div class="card-title">模态框的最大化</div>
  	    </header>
  		<div class="card-body">
          
          <p>其实v5已经有了模态框的最大化。</p>
  		  <p>这里旨在对模态框增加最大化的功能(因为是模态框的原因，在保留模态框的一些样式基础上最最大化处理)。css和绑定事件的js可以放到通用的文件当中，模态框新增最大化按钮即可。</p>
          <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
            打开模态框
          </button>
          <div class="modal fade" id="myModal">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="myModalLabel">标题</h6>
                  <div class="float-end">
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    <button type="button" class="modal-fullscreen-btn"><i class="mdi"></i></button>
                  </div>
                </div>
                <div class="modal-body">
                内容
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存</button>
                </div>
              </div>
            </div>
          </div>
          
  	    </div>
  	  </div>
    </div>

  </div>

</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(document).on('click', '.modal-fullscreen-btn', function(){
        $(this).closest('.modal').toggleClass('modal-fullscreen');
    });
});
</script>
</body>
</html>